#include<bits/stdc++.h>
#define ll long long
#define gua(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
ll n,p;
ll gg[20000666];
void write(int a){
	if(a<0)putchar('-'),a=-a;
	if(a>9)write(a/10);
	putchar(a%10+'0');
}
int main(){
	cin>>n>>p;gg[1]=1;
	gua(i,2,n)gg[i]=p-(p/i)*gg[p%i]%p;
    gua(i,1,n)write(gg[i]),putchar('\n');
	return 0;
}
